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

class B:
    def __init__(self, txt: str):
        self.p: F = None
        self.q: D = None
        self.t: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.x: C = None
        self.r: E = None
        self.p: C = None
        self.y: F = None
        self.q: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.u: A = None
        self.txt = txt

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

b = A("b")
m = B("m")
c = C("c")
e = D("e")
i = E("i")
n = F("n")
k = E("k")

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

class B:
    def __init__(self, txt: str):
        self.p: F = None
        self.q: D = None
        self.t: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.x: C = None
        self.r: E = None
        self.p: C = None
        self.y: F = None
        self.q: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.u: A = None
        self.txt = txt

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

b = A("b")
m = B("m")
c = C("c")
e = D("e")
i = E("i")
n = F("n")
k = E("k")

b.x = e
m.p = n
m.t = n
m.q = e
c.q = e
c.y = e
c.u = m
c.z = i
e.v = i
e.r = i
e.x = c
e.p = c
e.y = n
e.q = n
i.s = c
i.u = b
n.r = b
n.y = e
k.s = c
k.u = b
assert i.s.u.p.r.x.txt == "e"