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

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

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

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

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

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

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

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

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

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

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

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

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

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

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