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

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

n = A("n")
b = B("b")
h = A("h")
j = B("j")
l = B("l")
m = B("m")
c = A("c")

n.y = h
n.t = c
b.o = n
h.y = n
h.t = c
j.o = h
l.o = n
m.o = h
c.y = n
c.t = n
assert b.o.y.y.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.t: A = None
        self.txt = txt

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

n = A("n")
b = B("b")
h = A("h")
j = B("j")
l = B("l")
m = B("m")
c = A("c")

n.y = h
n.t = c
b.o = n
h.y = n
h.t = c
j.o = h
l.o = n
m.o = h
c.y = n
c.t = n
assert b.o.y.y.t.y.txt == "n"