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

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

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

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

b = A("b")
l = B("l")
k = C("k")
a = D("a")
m = C("m")
f = A("f")
e = B("e")
d = D("d")
g = A("g")
j = D("j")

b.r = l
b.w = g
b.x = e
l.u = f
l.x = e
k.o = e
k.q = b
k.x = l
k.p = j
a.u = e
m.o = l
m.x = l
m.q = b
m.p = j
f.r = l
f.w = b
f.x = e
e.u = b
e.x = l
d.u = e
g.r = l
g.x = l
g.w = f
j.u = l
assert e.x.x.x.u.x.u.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.w: A = None
        self.x: B = None
        self.txt = txt

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

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

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

b = A("b")
l = B("l")
k = C("k")
a = D("a")
m = C("m")
f = A("f")
e = B("e")
d = D("d")
g = A("g")
j = D("j")

b.r = l
b.w = g
b.x = e
l.u = f
l.x = e
k.o = e
k.q = b
k.x = l
k.p = j
a.u = e
m.o = l
m.x = l
m.q = b
m.p = j
f.r = l
f.w = b
f.x = e
e.u = b
e.x = l
d.u = e
g.r = l
g.x = l
g.w = f
j.u = l
assert e.x.x.x.u.x.u.txt == "b"