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

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

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

i = A("i")
g = B("g")
k = C("k")
n = C("n")
h = A("h")
a = B("a")
j = C("j")
e = C("e")
c = B("c")

i.x = e
i.t = h
g.y = h
g.p = h
k.y = i
n.y = i
h.x = e
h.t = i
a.y = h
a.p = i
j.y = i
e.y = h
c.y = i
c.p = h
assert j.y.x.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.t: A = None
        self.txt = txt

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

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

i = A("i")
g = B("g")
k = C("k")
n = C("n")
h = A("h")
a = B("a")
j = C("j")
e = C("e")
c = B("c")

i.x = e
i.t = h
g.y = h
g.p = h
k.y = i
n.y = i
h.x = e
h.t = i
a.y = h
a.p = i
j.y = i
e.y = h
c.y = i
c.p = h
assert j.y.x.y.t.txt == "i"