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

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

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.p: C = None
        self.x: C = None
        self.t: C = None
        self.w: F = None
        self.z: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.s: B = None
        self.x: E = None
        self.p: A = None
        self.v: D = None
        self.o: D = None
        self.txt = txt

k = A("k")
c = B("c")
m = C("m")
h = D("h")
g = E("g")
b = F("b")
d = B("d")

k.t = g
k.q = g
k.r = m
k.p = m
c.q = g
c.x = d
m.r = k
h.o = m
h.p = m
h.x = m
h.t = m
h.w = b
h.z = k
g.r = d
b.s = c
b.x = g
b.p = k
b.v = h
b.o = h
d.q = g
d.x = c
assert c.x.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.q: E = None
        self.r: C = None
        self.p: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.p: C = None
        self.x: C = None
        self.t: C = None
        self.w: F = None
        self.z: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.s: B = None
        self.x: E = None
        self.p: A = None
        self.v: D = None
        self.o: D = None
        self.txt = txt

k = A("k")
c = B("c")
m = C("m")
h = D("h")
g = E("g")
b = F("b")
d = B("d")

k.t = g
k.q = g
k.r = m
k.p = m
c.q = g
c.x = d
m.r = k
h.o = m
h.p = m
h.x = m
h.t = m
h.w = b
h.z = k
g.r = d
b.s = c
b.x = g
b.p = k
b.v = h
b.o = h
d.q = g
d.x = c
assert c.x.q.r.txt == "d"