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

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

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

e = A("e")
j = B("j")
m = C("m")
l = C("l")
g = C("g")
h = B("h")
i = C("i")
d = A("d")
c = B("c")
k = B("k")

e.o = d
e.v = m
e.x = k
j.t = d
m.r = d
m.t = h
l.r = e
l.t = k
g.r = d
g.t = h
h.t = e
i.r = d
i.t = c
d.o = e
d.v = m
d.x = c
c.t = d
k.t = e
assert g.t.t.v.r.x.t.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.v: C = None
        self.x: B = None
        self.txt = txt

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

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

e = A("e")
j = B("j")
m = C("m")
l = C("l")
g = C("g")
h = B("h")
i = C("i")
d = A("d")
c = B("c")
k = B("k")

e.o = d
e.v = m
e.x = k
j.t = d
m.r = d
m.t = h
l.r = e
l.t = k
g.r = d
g.t = h
h.t = e
i.r = d
i.t = c
d.o = e
d.v = m
d.x = c
c.t = d
k.t = e
assert g.t.t.v.r.x.t.v.t.txt == "h"