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

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

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

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

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

l.q = b
l.u = k
l.s = j
j.q = l
j.s = l
j.x = g
b.r = l
g.s = l
g.y = l
e.q = l
e.s = l
e.x = g
k.s = l
k.y = l
assert g.y.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.u: D = None
        self.s: B = None
        self.txt = txt

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

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

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

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

l.q = b
l.u = k
l.s = j
j.q = l
j.s = l
j.x = g
b.r = l
g.s = l
g.y = l
e.q = l
e.s = l
e.x = g
k.s = l
k.y = l
assert g.y.u.y.txt == "l"