class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: C = None
        self.p: D = None
        self.u: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: D = None
        self.q: D = None
        self.txt = txt

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

e.s = c
e.v = b
e.p = i
e.u = i
g.o = j
b.p = e
b.w = l
f.r = i
f.q = i
i.r = f
i.q = f
l.p = e
l.w = b
j.s = c
j.v = b
j.p = i
j.u = f
c.s = j
c.v = b
c.p = f
c.u = i
assert b.p.p.r.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: C = None
        self.p: D = None
        self.u: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: D = None
        self.q: D = None
        self.txt = txt

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

e.s = c
e.v = b
e.p = i
e.u = i
g.o = j
b.p = e
b.w = l
f.r = i
f.q = i
i.r = f
i.q = f
l.p = e
l.w = b
j.s = c
j.v = b
j.p = i
j.u = f
c.s = j
c.v = b
c.p = f
c.u = i
assert b.p.p.r.q.r.txt == "f"