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

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

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

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

a.x = h
i.o = f
i.t = f
i.q = b
f.p = h
f.x = h
f.o = h
b.o = f
b.t = f
b.q = i
h.p = f
h.x = f
h.o = f
j.o = h
j.t = h
j.q = e
e.o = f
e.t = f
e.q = i
assert h.x.x.p.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

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

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

a.x = h
i.o = f
i.t = f
i.q = b
f.p = h
f.x = h
f.o = h
b.o = f
b.t = f
b.q = i
h.p = f
h.x = f
h.o = f
j.o = h
j.t = h
j.q = e
e.o = f
e.t = f
e.q = i
assert h.x.x.p.txt == "f"