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

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

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

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

c = A("c")
e = B("e")
j = C("j")
m = D("m")
b = B("b")
i = C("i")
k = B("k")

c.r = i
c.v = m
e.y = c
e.w = m
e.r = m
e.p = i
j.p = c
m.t = e
m.u = b
m.q = b
m.o = j
b.y = c
b.w = m
b.r = m
b.p = i
i.p = c
k.y = c
k.w = m
k.r = m
k.p = i
assert e.w.o.p.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.v: D = None
        self.txt = txt

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

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

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

c = A("c")
e = B("e")
j = C("j")
m = D("m")
b = B("b")
i = C("i")
k = B("k")

c.r = i
c.v = m
e.y = c
e.w = m
e.r = m
e.p = i
j.p = c
m.t = e
m.u = b
m.q = b
m.o = j
b.y = c
b.w = m
b.r = m
b.p = i
i.p = c
k.y = c
k.w = m
k.r = m
k.p = i
assert e.w.o.p.v.t.txt == "e"