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

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

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

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

g = A("g")
f = B("f")
c = C("c")
a = D("a")
k = C("k")
j = A("j")

g.q = f
g.s = f
f.p = k
f.u = j
f.w = j
c.y = a
c.v = f
a.v = c
k.y = a
k.v = f
j.q = f
j.s = f
assert c.y.v.y.v.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.s: B = None
        self.txt = txt

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

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

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

g = A("g")
f = B("f")
c = C("c")
a = D("a")
k = C("k")
j = A("j")

g.q = f
g.s = f
f.p = k
f.u = j
f.w = j
c.y = a
c.v = f
a.v = c
k.y = a
k.v = f
j.q = f
j.s = f
assert c.y.v.y.v.y.v.txt == "c"