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

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

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

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

g = A("g")
b = B("b")
e = C("e")
l = D("l")
n = D("n")
f = C("f")
j = B("j")

g.o = b
b.t = e
b.r = g
e.x = g
e.u = g
e.y = j
e.q = f
l.x = n
l.w = f
n.x = l
n.w = f
f.x = g
f.u = g
f.y = j
f.q = e
j.t = e
j.r = g
assert b.r.o.r.o.t.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

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

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

g = A("g")
b = B("b")
e = C("e")
l = D("l")
n = D("n")
f = C("f")
j = B("j")

g.o = b
b.t = e
b.r = g
e.x = g
e.u = g
e.y = j
e.q = f
l.x = n
l.w = f
n.x = l
n.w = f
f.x = g
f.u = g
f.y = j
f.q = e
j.t = e
j.r = g
assert b.r.o.r.o.t.q.q.txt == "e"