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

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: F = None
        self.w: C = None
        self.txt = txt

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

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

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

b.t = e
b.r = e
b.q = j
b.z = c
e.u = d
d.v = c
c.s = b
c.v = a
c.w = d
j.y = b
j.x = b
a.u = d
a.x = c
assert j.y.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.r: B = None
        self.q: E = None
        self.z: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: F = None
        self.w: C = None
        self.txt = txt

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

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

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

b.t = e
b.r = e
b.q = j
b.z = c
e.u = d
d.v = c
c.s = b
c.v = a
c.w = d
j.y = b
j.x = b
a.u = d
a.x = c
assert j.y.z.w.txt == "d"