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

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

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

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

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

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

h = A("h")
j = B("j")
d = C("d")
f = D("f")
e = E("e")
g = F("g")

h.t = f
h.y = f
h.o = e
j.u = h
d.y = h
d.v = h
d.o = j
f.s = h
f.u = h
f.y = d
f.p = j
e.r = d
e.u = g
e.y = g
e.x = f
g.t = d
g.x = d
g.p = j
assert d.y.o.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.o: E = None
        self.y: D = None
        self.txt = txt

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

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

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

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

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

h = A("h")
j = B("j")
d = C("d")
f = D("f")
e = E("e")
g = F("g")

h.t = f
h.y = f
h.o = e
j.u = h
d.y = h
d.v = h
d.o = j
f.s = h
f.u = h
f.y = d
f.p = j
e.r = d
e.u = g
e.y = g
e.x = f
g.t = d
g.x = d
g.p = j
assert d.y.o.r.v.txt == "h"