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

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

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

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

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

g.q = k
g.u = k
g.y = b
g.t = b
b.o = e
b.v = g
e.s = k
k.w = b
k.o = b
k.s = b
k.t = g
assert b.v.q.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: B = None
        self.t: B = None
        self.u: D = None
        self.txt = txt

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

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

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

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

g.q = k
g.u = k
g.y = b
g.t = b
b.o = e
b.v = g
e.s = k
k.w = b
k.o = b
k.s = b
k.t = g
assert b.v.q.t.q.txt == "k"