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

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

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

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

k = A("k")
d = B("d")
e = C("e")
j = D("j")
g = C("g")
c = D("c")

k.w = c
k.p = j
d.t = j
e.y = c
e.r = c
e.o = k
e.q = d
j.w = c
g.y = j
g.r = j
g.o = k
g.q = d
c.w = j
assert e.o.p.w.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.p: D = None
        self.txt = txt

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

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

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

k = A("k")
d = B("d")
e = C("e")
j = D("j")
g = C("g")
c = D("c")

k.w = c
k.p = j
d.t = j
e.y = c
e.r = c
e.o = k
e.q = d
j.w = c
g.y = j
g.r = j
g.o = k
g.q = d
c.w = j
assert e.o.p.w.w.w.w.txt == "j"