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

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

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: F = None
        self.s: B = None
        self.r: F = None
        self.q: F = None
        self.txt = txt

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

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

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

i = A("i")
e = B("e")
j = C("j")
g = D("g")
b = E("b")
m = F("m")
k = F("k")

i.x = g
i.p = k
e.x = j
e.t = b
j.y = g
j.z = k
j.r = k
j.s = e
j.q = m
g.z = e
b.u = g
b.o = e
b.r = e
m.u = e
m.z = b
k.u = e
k.z = b
assert j.q.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.p: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: F = None
        self.s: B = None
        self.r: F = None
        self.q: F = None
        self.txt = txt

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

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

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

i = A("i")
e = B("e")
j = C("j")
g = D("g")
b = E("b")
m = F("m")
k = F("k")

i.x = g
i.p = k
e.x = j
e.t = b
j.y = g
j.z = k
j.r = k
j.s = e
j.q = m
g.z = e
b.u = g
b.o = e
b.r = e
m.u = e
m.z = b
k.u = e
k.z = b
assert j.q.u.x.txt == "j"