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

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

class C:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.r: A = None
        self.t: E = None
        self.v: A = None
        self.x: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: E = None
        self.w: A = None
        self.q: C = None
        self.v: A = None
        self.p: B = None
        self.txt = txt

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

n.t = i
n.v = i
n.r = d
d.r = f
i.o = c
c.y = n
c.r = n
c.v = n
c.t = f
c.x = h
f.x = n
f.u = c
f.y = i
h.o = f
h.w = n
h.v = n
h.q = i
h.p = d
assert d.r.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.v: C = None
        self.r: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.r: A = None
        self.t: E = None
        self.v: A = None
        self.x: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: E = None
        self.w: A = None
        self.q: C = None
        self.v: A = None
        self.p: B = None
        self.txt = txt

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

n.t = i
n.v = i
n.r = d
d.r = f
i.o = c
c.y = n
c.r = n
c.v = n
c.t = f
c.x = h
f.x = n
f.u = c
f.y = i
h.o = f
h.w = n
h.v = n
h.q = i
h.p = d
assert d.r.u.x.txt == "h"