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

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

l = A("l")
k = B("k")
f = C("f")
e = D("e")
c = E("c")
b = C("b")
i = D("i")
m = A("m")
h = D("h")
j = B("j")

l.q = c
k.p = c
f.w = b
f.y = b
f.u = c
f.o = j
e.x = b
c.y = e
b.w = f
b.y = f
b.u = c
b.o = k
i.x = b
m.q = c
h.x = b
j.p = c
assert b.u.y.x.u.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

l = A("l")
k = B("k")
f = C("f")
e = D("e")
c = E("c")
b = C("b")
i = D("i")
m = A("m")
h = D("h")
j = B("j")

l.q = c
k.p = c
f.w = b
f.y = b
f.u = c
f.o = j
e.x = b
c.y = e
b.w = f
b.y = f
b.u = c
b.o = k
i.x = b
m.q = c
h.x = b
j.p = c
assert b.u.y.x.u.y.x.txt == "b"