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

class B:
    def __init__(self, txt: str):
        self.x: F = None
        self.o: E = None
        self.r: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

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

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

i = A("i")
b = B("b")
g = C("g")
l = D("l")
f = E("f")
n = F("n")

i.r = b
i.o = b
b.x = n
b.o = f
b.r = g
g.p = f
l.u = b
l.s = g
f.r = b
f.t = n
n.y = b
n.x = g
n.w = l
assert g.p.t.w.s.p.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.o: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: F = None
        self.o: E = None
        self.r: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

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

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

i = A("i")
b = B("b")
g = C("g")
l = D("l")
f = E("f")
n = F("n")

i.r = b
i.o = b
b.x = n
b.o = f
b.r = g
g.p = f
l.u = b
l.s = g
f.r = b
f.t = n
n.y = b
n.x = g
n.w = l
assert g.p.t.w.s.p.txt == "f"