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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: B = None
        self.w: C = None
        self.r: A = None
        self.y: C = None
        self.v: B = None
        self.x: C = None
        self.txt = txt

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

n.u = d
n.v = c
n.y = b
n.o = j
j.z = c
j.x = n
k.q = c
b.w = h
d.x = b
d.u = b
d.y = j
c.u = j
c.v = j
c.w = h
c.y = h
c.r = n
c.x = k
h.q = c
assert j.x.v.y.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.v: F = None
        self.y: D = None
        self.o: B = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: B = None
        self.w: C = None
        self.r: A = None
        self.y: C = None
        self.v: B = None
        self.x: C = None
        self.txt = txt

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

n.u = d
n.v = c
n.y = b
n.o = j
j.z = c
j.x = n
k.q = c
b.w = h
d.x = b
d.u = b
d.y = j
c.u = j
c.v = j
c.w = h
c.y = h
c.r = n
c.x = k
h.q = c
assert j.x.v.y.txt == "h"