class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.t: F = None
        self.y: A = None
        self.u: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.s: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: F = None
        self.r: D = None
        self.y: E = None
        self.txt = txt

a = A("a")
n = B("n")
f = C("f")
e = D("e")
h = E("h")
d = F("d")
c = A("c")
m = F("m")
g = D("g")
i = C("i")

a.r = e
a.t = d
a.y = c
a.u = i
n.q = h
f.s = h
e.v = m
h.o = i
h.s = d
d.p = m
d.r = e
d.y = h
c.r = g
c.t = m
c.y = a
c.u = f
m.p = d
m.r = e
m.y = h
g.v = m
i.s = h
assert g.v.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.t: F = None
        self.y: A = None
        self.u: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.s: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: F = None
        self.r: D = None
        self.y: E = None
        self.txt = txt

a = A("a")
n = B("n")
f = C("f")
e = D("e")
h = E("h")
d = F("d")
c = A("c")
m = F("m")
g = D("g")
i = C("i")

a.r = e
a.t = d
a.y = c
a.u = i
n.q = h
f.s = h
e.v = m
h.o = i
h.s = d
d.p = m
d.r = e
d.y = h
c.r = g
c.t = m
c.y = a
c.u = f
m.p = d
m.r = e
m.y = h
g.v = m
i.s = h
assert g.v.y.o.txt == "i"