class A:
    def __init__(self, txt: str):
        self.u: F = None
        self.x: D = None
        self.t: D = None
        self.o: D = None
        self.p: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

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

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

j = A("j")
g = B("g")
d = C("d")
h = D("h")
n = E("n")
c = F("c")

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

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

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

class D:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

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

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

j = A("j")
g = B("g")
d = C("d")
h = D("h")
n = E("n")
c = F("c")

j.u = c
j.x = h
j.t = h
j.o = h
j.p = h
g.u = j
g.x = j
g.t = d
g.p = d
d.r = n
h.s = j
n.v = h
n.y = j
n.r = j
c.y = h
c.q = d
c.v = g
c.x = n
assert c.q.r.v.txt == "h"