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

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

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

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

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

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

d = A("d")
f = B("f")
c = C("c")
m = D("m")
a = E("a")
j = F("j")
b = F("b")
k = B("k")

d.o = k
d.p = j
d.q = c
d.w = m
d.y = f
d.r = a
f.w = c
c.v = a
m.u = c
m.v = k
a.y = c
a.r = c
j.p = b
j.v = f
j.u = f
j.s = a
j.z = m
b.p = j
b.v = f
b.s = a
b.u = k
b.z = m
k.w = c
assert b.u.w.v.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.p: F = None
        self.q: C = None
        self.w: D = None
        self.y: B = None
        self.r: E = None
        self.txt = txt

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

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

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

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

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

d = A("d")
f = B("f")
c = C("c")
m = D("m")
a = E("a")
j = F("j")
b = F("b")
k = B("k")

d.o = k
d.p = j
d.q = c
d.w = m
d.y = f
d.r = a
f.w = c
c.v = a
m.u = c
m.v = k
a.y = c
a.r = c
j.p = b
j.v = f
j.u = f
j.s = a
j.z = m
b.p = j
b.v = f
b.s = a
b.u = k
b.z = m
k.w = c
assert b.u.w.v.r.v.txt == "a"