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

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.v: A = 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.z: B = None
        self.x: C = None
        self.y: F = None
        self.s: B = None
        self.p: E = None
        self.txt = txt

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

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

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

i.r = j
f.u = g
f.v = c
n.o = e
e.z = h
e.s = h
e.x = n
e.y = k
e.p = g
g.o = e
g.s = h
g.w = c
g.p = i
k.s = n
j.r = i
h.u = g
h.v = j
c.r = j
b.o = e
assert n.o.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.v: A = 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.z: B = None
        self.x: C = None
        self.y: F = None
        self.s: B = None
        self.p: E = None
        self.txt = txt

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

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

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

i.r = j
f.u = g
f.v = c
n.o = e
e.z = h
e.s = h
e.x = n
e.y = k
e.p = g
g.o = e
g.s = h
g.w = c
g.p = i
k.s = n
j.r = i
h.u = g
h.v = j
c.r = j
b.o = e
assert n.o.p.s.txt == "h"