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

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

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

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

k = A("k")
h = B("h")
j = C("j")
m = D("m")
l = A("l")
c = C("c")

k.r = h
k.w = c
k.p = m
h.s = l
j.r = c
j.t = c
j.y = l
j.u = h
m.v = c
m.y = h
l.r = h
l.w = c
l.p = m
c.r = j
c.t = j
c.y = k
c.u = h
assert c.u.s.r.s.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.w: C = None
        self.p: D = None
        self.txt = txt

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

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

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

k = A("k")
h = B("h")
j = C("j")
m = D("m")
l = A("l")
c = C("c")

k.r = h
k.w = c
k.p = m
h.s = l
j.r = c
j.t = c
j.y = l
j.u = h
m.v = c
m.y = h
l.r = h
l.w = c
l.p = m
c.r = j
c.t = j
c.y = k
c.u = h
assert c.u.s.r.s.w.y.txt == "k"