class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.u: D = None
        self.q: F = None
        self.x: F = None
        self.v: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: E = None
        self.x: E = None
        self.y: B = None
        self.txt = txt

d = A("d")
g = B("g")
h = C("h")
a = D("a")
i = E("i")
b = F("b")
n = B("n")
j = D("j")

d.r = i
g.y = n
h.t = n
a.t = d
a.o = i
i.z = h
i.u = j
i.q = b
i.x = b
i.v = b
b.s = i
b.x = i
b.y = g
n.y = g
j.t = d
j.o = i
assert h.t.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.u: D = None
        self.q: F = None
        self.x: F = None
        self.v: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: E = None
        self.x: E = None
        self.y: B = None
        self.txt = txt

d = A("d")
g = B("g")
h = C("h")
a = D("a")
i = E("i")
b = F("b")
n = B("n")
j = D("j")

d.r = i
g.y = n
h.t = n
a.t = d
a.o = i
i.z = h
i.u = j
i.q = b
i.x = b
i.v = b
b.s = i
b.x = i
b.y = g
n.y = g
j.t = d
j.o = i
assert h.t.y.y.y.txt == "g"