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

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

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

i = A("i")
e = B("e")
f = C("f")
g = C("g")
b = B("b")
a = C("a")

i.t = e
e.t = b
e.y = b
e.o = g
f.x = e
g.x = b
b.t = e
b.y = e
b.o = g
a.x = b
assert f.x.y.o.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

i = A("i")
e = B("e")
f = C("f")
g = C("g")
b = B("b")
a = C("a")

i.t = e
e.t = b
e.y = b
e.o = g
f.x = e
g.x = b
b.t = e
b.y = e
b.o = g
a.x = b
assert f.x.y.o.x.txt == "b"