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

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

class C:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: F = None
        self.u: A = None
        self.txt = txt

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

h = A("h")
g = B("g")
n = C("n")
j = D("j")
f = E("f")
a = F("a")

h.r = a
h.t = a
h.o = a
g.z = a
n.r = a
j.t = f
j.s = g
j.u = g
j.y = a
f.y = a
f.u = h
a.u = n
a.t = h
assert h.r.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.t: F = None
        self.o: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: F = None
        self.u: A = None
        self.txt = txt

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

h = A("h")
g = B("g")
n = C("n")
j = D("j")
f = E("f")
a = F("a")

h.r = a
h.t = a
h.o = a
g.z = a
n.r = a
j.t = f
j.s = g
j.u = g
j.y = a
f.y = a
f.u = h
a.u = n
a.t = h
assert h.r.t.o.txt == "a"