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

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

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: E = None
        self.o: C = None
        self.z: C = None
        self.u: C = None
        self.txt = txt

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

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

l.z = j
l.u = j
l.p = j
b.p = f
c.x = l
j.t = c
f.y = h
f.o = c
f.z = c
f.u = c
n.x = l
n.o = f
n.v = b
h.y = f
h.o = c
h.z = c
h.u = c
assert j.t.x.z.t.x.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.u: D = None
        self.p: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: E = None
        self.o: C = None
        self.z: C = None
        self.u: C = None
        self.txt = txt

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

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

l.z = j
l.u = j
l.p = j
b.p = f
c.x = l
j.t = c
f.y = h
f.o = c
f.z = c
f.u = c
n.x = l
n.o = f
n.v = b
h.y = f
h.o = c
h.z = c
h.u = c
assert j.t.x.z.t.x.p.txt == "j"