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

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

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

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.w: E = 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.v: A = None
        self.z: B = None
        self.x: A = None
        self.u: B = None
        self.q: C = None
        self.y: E = None
        self.txt = txt

l = A("l")
b = B("b")
d = C("d")
k = D("k")
e = E("e")
c = F("c")
g = E("g")
j = B("j")
i = C("i")
f = F("f")

l.r = f
b.y = l
d.z = f
d.o = c
k.q = g
k.w = e
e.r = b
c.v = l
c.x = l
c.z = b
c.u = b
c.q = d
c.y = g
g.r = j
j.y = l
i.z = c
i.o = c
f.v = l
f.x = l
f.z = j
f.u = b
f.q = i
f.y = e
assert j.y.r.x.r.z.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.w: E = 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.v: A = None
        self.z: B = None
        self.x: A = None
        self.u: B = None
        self.q: C = None
        self.y: E = None
        self.txt = txt

l = A("l")
b = B("b")
d = C("d")
k = D("k")
e = E("e")
c = F("c")
g = E("g")
j = B("j")
i = C("i")
f = F("f")

l.r = f
b.y = l
d.z = f
d.o = c
k.q = g
k.w = e
e.r = b
c.v = l
c.x = l
c.z = b
c.u = b
c.q = d
c.y = g
g.r = j
j.y = l
i.z = c
i.o = c
f.v = l
f.x = l
f.z = j
f.u = b
f.q = i
f.y = e
assert j.y.r.x.r.z.y.txt == "l"