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

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

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.o: B = None
        self.p: B = None
        self.txt = txt

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

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

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

m = A("m")
n = B("n")
k = C("k")
j = D("j")
f = E("f")
g = F("g")
b = D("b")
d = C("d")
l = C("l")

m.o = j
n.r = m
k.q = m
k.o = n
k.p = n
j.t = b
j.w = b
j.y = m
j.p = l
j.o = k
f.w = m
f.y = m
f.u = m
f.s = j
g.y = j
g.u = n
g.t = m
g.w = b
b.t = j
b.w = j
b.y = m
b.p = l
b.o = k
d.q = m
d.o = n
d.p = n
l.q = m
l.o = n
l.p = n
assert b.o.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.o: B = None
        self.p: B = None
        self.txt = txt

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

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

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

m = A("m")
n = B("n")
k = C("k")
j = D("j")
f = E("f")
g = F("g")
b = D("b")
d = C("d")
l = C("l")

m.o = j
n.r = m
k.q = m
k.o = n
k.p = n
j.t = b
j.w = b
j.y = m
j.p = l
j.o = k
f.w = m
f.y = m
f.u = m
f.s = j
g.y = j
g.u = n
g.t = m
g.w = b
b.t = j
b.w = j
b.y = m
b.p = l
b.o = k
d.q = m
d.o = n
d.p = n
l.q = m
l.o = n
l.p = n
assert b.o.q.o.txt == "j"