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

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

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

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

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

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

g = A("g")
b = B("b")
k = C("k")
f = D("f")
m = E("m")
i = F("i")
c = C("c")

g.u = b
g.x = m
b.y = i
b.u = m
k.x = c
k.u = b
k.r = m
k.w = f
f.v = g
f.u = b
m.w = g
m.p = g
m.v = f
m.z = i
i.u = m
c.x = k
c.u = b
c.r = m
c.w = f
assert k.r.z.u.z.u.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.x: E = None
        self.txt = txt

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

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

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

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

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

g = A("g")
b = B("b")
k = C("k")
f = D("f")
m = E("m")
i = F("i")
c = C("c")

g.u = b
g.x = m
b.y = i
b.u = m
k.x = c
k.u = b
k.r = m
k.w = f
f.v = g
f.u = b
m.w = g
m.p = g
m.v = f
m.z = i
i.u = m
c.x = k
c.u = b
c.r = m
c.w = f
assert k.r.z.u.z.u.p.u.txt == "b"