class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.x: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.z: E = None
        self.u: A = None
        self.t: E = None
        self.s: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.r: F = None
        self.o: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.q: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.o: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: C = None
        self.w: B = None
        self.s: C = None
        self.o: E = None
        self.x: C = None
        self.txt = txt

h = A("h")
b = B("b")
n = C("n")
f = D("f")
j = E("j")
i = F("i")
c = G("c")

h.p = j
h.x = j
b.o = h
b.u = h
b.s = h
b.z = j
b.t = j
n.x = j
n.r = i
n.o = b
f.z = h
f.q = b
j.u = c
i.z = b
i.o = n
c.y = n
c.s = n
c.x = n
c.w = b
c.o = j
assert f.z.x.u.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.x: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.z: E = None
        self.u: A = None
        self.t: E = None
        self.s: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.r: F = None
        self.o: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.q: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.o: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: C = None
        self.w: B = None
        self.s: C = None
        self.o: E = None
        self.x: C = None
        self.txt = txt

h = A("h")
b = B("b")
n = C("n")
f = D("f")
j = E("j")
i = F("i")
c = G("c")

h.p = j
h.x = j
b.o = h
b.u = h
b.s = h
b.z = j
b.t = j
n.x = j
n.r = i
n.o = b
f.z = h
f.q = b
j.u = c
i.z = b
i.o = n
c.y = n
c.s = n
c.x = n
c.w = b
c.o = j
assert f.z.x.u.o.txt == "j"