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

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

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

g = A("g")
a = B("a")
b = C("b")
j = C("j")
k = B("k")

g.o = k
g.x = k
g.p = b
a.w = k
a.r = g
a.v = b
b.s = g
b.t = j
b.r = k
j.s = g
j.t = b
j.r = k
k.w = a
k.r = g
k.v = j
assert g.p.t.t.s.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.p: C = None
        self.x: B = None
        self.txt = txt

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

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

g = A("g")
a = B("a")
b = C("b")
j = C("j")
k = B("k")

g.o = k
g.x = k
g.p = b
a.w = k
a.r = g
a.v = b
b.s = g
b.t = j
b.r = k
j.s = g
j.t = b
j.r = k
k.w = a
k.r = g
k.v = j
assert g.p.t.t.s.o.txt == "k"