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

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

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

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

b = A("b")
h = B("h")
j = C("j")
k = D("k")
e = C("e")

b.s = e
b.p = h
b.t = h
b.u = k
h.r = b
j.w = e
j.q = h
k.t = h
k.q = h
k.p = h
k.s = b
e.w = j
e.q = h
assert j.q.r.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.p: B = None
        self.u: D = None
        self.t: B = None
        self.txt = txt

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

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

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

b = A("b")
h = B("h")
j = C("j")
k = D("k")
e = C("e")

b.s = e
b.p = h
b.t = h
b.u = k
h.r = b
j.w = e
j.q = h
k.t = h
k.q = h
k.p = h
k.s = b
e.w = j
e.q = h
assert j.q.r.s.txt == "e"