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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.t: E = None
        self.r: D = None
        self.z: B = None
        self.u: E = None
        self.w: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.y: E = None
        self.u: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

a = A("a")
c = B("c")
l = C("l")
j = D("j")
e = E("e")
d = F("d")
n = F("n")

a.t = l
a.p = n
c.s = a
l.p = j
l.r = j
l.t = e
l.u = e
l.z = c
l.w = d
j.t = c
j.y = e
j.u = d
e.u = j
e.p = j
d.x = j
n.x = j
assert d.x.y.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.p: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.t: E = None
        self.r: D = None
        self.z: B = None
        self.u: E = None
        self.w: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.y: E = None
        self.u: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

a = A("a")
c = B("c")
l = C("l")
j = D("j")
e = E("e")
d = F("d")
n = F("n")

a.t = l
a.p = n
c.s = a
l.p = j
l.r = j
l.t = e
l.u = e
l.z = c
l.w = d
j.t = c
j.y = e
j.u = d
e.u = j
e.p = j
d.x = j
n.x = j
assert d.x.y.p.txt == "j"