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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.r: B = None
        self.p: B = None
        self.w: A = None
        self.txt = txt

n = A("n")
m = B("m")
e = C("e")
f = D("f")
c = E("c")
j = F("j")
a = C("a")
b = B("b")
d = A("d")

n.y = d
n.p = d
n.w = a
n.r = f
m.u = b
m.q = c
e.w = f
f.q = j
f.p = c
f.v = n
c.v = f
c.x = m
j.r = b
j.p = m
j.w = d
a.w = f
b.u = m
b.q = c
d.y = n
d.p = n
d.w = e
d.r = f
assert d.r.p.v.p.x.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.p: A = None
        self.w: C = None
        self.r: D = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.r: B = None
        self.p: B = None
        self.w: A = None
        self.txt = txt

n = A("n")
m = B("m")
e = C("e")
f = D("f")
c = E("c")
j = F("j")
a = C("a")
b = B("b")
d = A("d")

n.y = d
n.p = d
n.w = a
n.r = f
m.u = b
m.q = c
e.w = f
f.q = j
f.p = c
f.v = n
c.v = f
c.x = m
j.r = b
j.p = m
j.w = d
a.w = f
b.u = m
b.q = c
d.y = n
d.p = n
d.w = e
d.r = f
assert d.r.p.v.p.x.u.txt == "b"