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

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: D = None
        self.q: F = None
        self.p: A = None
        self.t: D = None
        self.y: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.y: E = None
        self.v: E = None
        self.z: D = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

b = A("b")
e = B("e")
l = C("l")
h = D("h")
j = E("j")
m = F("m")
i = D("i")

b.t = h
e.o = m
e.q = j
l.x = h
l.s = h
l.q = m
l.p = b
l.t = i
l.y = i
h.p = j
h.y = j
h.v = j
h.z = i
j.z = h
m.p = b
i.p = j
i.y = j
i.v = j
i.z = h
assert l.p.t.y.z.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: D = None
        self.q: F = None
        self.p: A = None
        self.t: D = None
        self.y: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.y: E = None
        self.v: E = None
        self.z: D = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

b = A("b")
e = B("e")
l = C("l")
h = D("h")
j = E("j")
m = F("m")
i = D("i")

b.t = h
e.o = m
e.q = j
l.x = h
l.s = h
l.q = m
l.p = b
l.t = i
l.y = i
h.p = j
h.y = j
h.v = j
h.z = i
j.z = h
m.p = b
i.p = j
i.y = j
i.v = j
i.z = h
assert l.p.t.y.z.y.txt == "j"