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

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

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

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

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

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

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

n.u = f
n.q = g
g.q = n
g.s = b
f.p = h
f.r = j
f.v = e
f.t = b
f.x = n
j.y = n
h.o = g
h.y = e
h.s = j
h.p = n
e.v = b
e.y = j
b.u = f
b.q = g
assert j.y.u.r.y.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.q: B = None
        self.txt = txt

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

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

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

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

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

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

n.u = f
n.q = g
g.q = n
g.s = b
f.p = h
f.r = j
f.v = e
f.t = b
f.x = n
j.y = n
h.o = g
h.y = e
h.s = j
h.p = n
e.v = b
e.y = j
b.u = f
b.q = g
assert j.y.u.r.y.u.t.txt == "b"