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

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.r: E = 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.u: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: A = None
        self.w: C = None
        self.txt = txt

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

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

c.t = m
m.v = f
m.r = f
d.v = h
h.u = d
f.q = h
f.y = n
f.w = d
k.u = m
k.p = g
k.s = n
k.t = n
k.w = h
k.z = d
n.t = m
g.v = h
assert c.t.r.q.u.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.r: E = 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.u: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: A = None
        self.w: C = None
        self.txt = txt

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

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

c.t = m
m.v = f
m.r = f
d.v = h
h.u = d
f.q = h
f.y = n
f.w = d
k.u = m
k.p = g
k.s = n
k.t = n
k.w = h
k.z = d
n.t = m
g.v = h
assert c.t.r.q.u.v.u.txt == "d"