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

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

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

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

e = A("e")
f = B("f")
j = C("j")
a = D("a")

e.r = a
e.q = a
e.t = a
f.y = j
j.x = a
a.q = f
assert e.t.q.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.q: D = None
        self.t: D = None
        self.txt = txt

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

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

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

e = A("e")
f = B("f")
j = C("j")
a = D("a")

e.r = a
e.q = a
e.t = a
f.y = j
j.x = a
a.q = f
assert e.t.q.y.x.txt == "a"